{{- if .Values.userAuthn.publishAPI.enable }}
---
apiVersion: v1
kind: Service
metadata:
  name: kubernetes
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "kubernetes-configurator")) | nindent 2 }}
spec:
  clusterIP: None
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: {{ .Values.userAuthn.internal.kubernetesApiserverTargetPort }}
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: v1
kind: Endpoints
metadata:
  name: kubernetes
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "kubernetes-configurator")) | nindent 2 }}
subsets:
- addresses:
  {{- range $address := .Values.userAuthn.internal.kubernetesApiserverAddresses }}
  - ip: {{ $address }}
  {{- end }}
  ports:
  - name: https
    port: {{ .Values.userAuthn.internal.kubernetesApiserverTargetPort }}
    protocol: TCP
{{- end }}
